package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicAllocatOutwhItemDAO;
import com.cssy.xxkj.logic.entity.LogicAllocatOutwhItemDO;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-26
 */
public class LogicAllocatOutwhItemDAOImpl extends SqlMapClientDaoSupport implements LogicAllocatOutwhItemDAO {

    /**
     * 插入数据
     * @param logicAllocatOutwhItemDO
     * @return 插入数据的主键
     */
    public String insertLogicAllocatOutwhItemDO(LogicAllocatOutwhItemDO logicAllocatOutwhItemDO) {
        Object id = getSqlMapClientTemplate().insert("LogicAllocatOutwhItem.insert", logicAllocatOutwhItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicAllocatOutwhItemDO
     * @return 查出的记录数
     */
    public Integer countLogicAllocatOutwhItemDOByExample(LogicAllocatOutwhItemDO logicAllocatOutwhItemDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatOutwhItem.countByDOExample", logicAllocatOutwhItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicAllocatOutwhItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicAllocatOutwhItemDO(LogicAllocatOutwhItemDO logicAllocatOutwhItemDO) {
        int result = getSqlMapClientTemplate().update("LogicAllocatOutwhItem.update", logicAllocatOutwhItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicAllocatOutwhItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicAllocatOutwhItemDO> findListByExample(LogicAllocatOutwhItemDO logicAllocatOutwhItemDO) {
        List<LogicAllocatOutwhItemDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatOutwhItem.findListByDO", logicAllocatOutwhItemDO);
        return list;
    }
    
    
    @SuppressWarnings("unchecked")
	public List<LogicAllocatOutwhItemDO> findListByMap(Map<String, Object> paramMap)throws SyBaseException{
    	return getSqlMapClientTemplate().queryForList("LogicAllocatOutwhItem_ex.findListByMap", paramMap);
    }
    

    /**
     * 根据主键获取logicAllocatOutwhItemDO
     * @param id
     * @return logicAllocatOutwhItemDO
     */
    public LogicAllocatOutwhItemDO findLogicAllocatOutwhItemDOByPrimaryKey(String id) {
        LogicAllocatOutwhItemDO logicAllocatOutwhItemDO = (LogicAllocatOutwhItemDO) getSqlMapClientTemplate().queryForObject("LogicAllocatOutwhItem.findByPrimaryKey", id);
        return logicAllocatOutwhItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicAllocatOutwhItemDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicAllocatOutwhItem.deleteByPrimaryKey", id);
        return rows;
    }

    /**
     * 查询调拨发起所有行记录集合
     */
	@SuppressWarnings("unchecked")
	@Override
	public List<LogicAllocatOutwhItemDO> find(SearchConditions scs)
			throws DataAccessException {
		 List<LogicAllocatOutwhItemDO> list = getSqlMapClientTemplate().queryForList("LogicAllocatOutwhItem_ex.find", scs);
	     return list;
	}

	/**
     * 查询调拨发起所有行记录条数
     */
	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocatOutwhItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

}